package com.roam.service.impl;

import com.roam.DTO.SceneDetailDTO;
import com.roam.DTO.TourPlanDTO;
import com.roam.VO.SelectPagePopularSceneVO;
import com.roam.VO.TourPlanVO;
import com.roam.entity.scene.Scene;
import com.roam.mapper.SceneInfoMapper;
import com.roam.mapper.SelectPageMapper;
import com.roam.service.SelectPageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class SelectPageServiceImpl implements SelectPageService {

    @Autowired
    private SelectPageMapper selectPageMapper;

    @Override
    public List<SelectPagePopularSceneVO> getPopularScenes(String city) {
        List<SelectPagePopularSceneVO> selectPagePopularSceneVOS=new ArrayList<>();
        List<TourPlanVO> selectPagePopularScenes=selectPageMapper.getPopularScenes(city);
        for (TourPlanVO scene : selectPagePopularScenes) {
            SelectPagePopularSceneVO selectPagePopularSceneVO = SelectPagePopularSceneVO.builder()
                    .sceneID(scene.getId())
                    .city(scene.getCity())
                    .scene(scene.getName())
                    .build();
            selectPagePopularSceneVOS.add(selectPagePopularSceneVO);
        }
        return selectPagePopularSceneVOS;
    }

    @Override
    public List<TourPlanVO> getPopularTourPlanVOS(String city) {
        List<TourPlanVO> selectPagePopularTourPlanVOS=selectPageMapper.getPopularScenes(city);
        return selectPagePopularTourPlanVOS;
    }

    @Override
    public List<List<List<TourPlanVO>>> getTourPlan(TourPlanDTO tourPlanDTO) {

        return selectPageMapper.getTourPlan(tourPlanDTO);
    }


}
